using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Threading;
using Shared = Faust.Andrew.MTG.Player.Shared;

namespace Faust.Andrew.MTG.Player
{
    public class PlayerState : Shared.Player
    {
        public PlayerState()
        {
            Cards = new ObservableCollection<Faust.Andrew.MTG.Player.Shared.GameCard>();
        }

        public PlayerState(Shared.Player player) : this()
        {
            _name = player.Name;
            _counters = player.Counters;
            _deckCount = player.DeckCount;
            _deckName = player.DeckName;
            _handCount = player.HandCount;
            _lifeCounter = player.LifeCounter;
            _order = player.Order;
            _playerID = player.PlayerID;            
        }

        public Shared.Player GetBase()
        {
            return new Faust.Andrew.MTG.Player.Shared.Player()
            {
                Name = Name,
                Counters = Counters,
                DeckName = DeckName,
                DeckCount = DeckCount,
                HandCount = HandCount,
                LifeCounter = LifeCounter,
                Order = Order,
                PlayerID = PlayerID,
                IsDeckUnlocked = IsDeckUnlocked
            };
        }

        private ObservableCollection<Shared.GameCard> _cards;
        public ObservableCollection<Shared.GameCard> Cards
        {
            get { return _cards; }
            set
            {
                if (_cards != value)
                {
                    _cards = value;
                    FirePropertyChanged("Cards");
                }
            }
        }

        private bool _isTurn;
        public bool IsTurn
        {
            get { return _isTurn; }
            set
            {
                if (_isTurn != value)
                {
                    _isTurn = value;
                    FirePropertyChanged("IsTurn");
                }
            }
        }
    }
}
